package com.hzeport.bgs22emduty.enums;

import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * 操作类型
 */
@Getter
public enum ActionTypeEnum {
    SEL("0", "查询"),
    EXPORT("1", "导出"),
    DOWN_LOAD("2", "下载"),
;
    private final String code;
    private final String desc;

    ActionTypeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    @Override
    public String toString() {
        return this.getValue();
    }

    public String getValue() {
        return code;
    }

    public static String getDescByCode(String code) {
        if (StringUtils.isNotEmpty(code)) {
            for (ActionTypeEnum myEnum : ActionTypeEnum.values()) {
                if (StringUtils.equals(myEnum.getCode(), code)) {
                    return myEnum.desc;
                }
            }
        }
        return "";
    }
}
